package com.example.inami.exception;

import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionHandler {

    // 捕获 HttpMessageNotReadableException 异常
    @ExceptionHandler(HttpMessageNotReadableException.class)
    public ResponseEntity handleMethodArgumentNotReadableException(HttpMessageNotReadableException ex) {
        // 自定义响应类
        return ResponseEntity.badRequest().body("请见检查参数：" + ex.getMessage());
    }


}